import {createReplyBottomAtt, imgZoom,createAttachLi} from '../../util/communicationUtil';
import {WeaLocaleProvider} from 'ecCom';
import { toJS } from 'mobx';
const getLabel = WeaLocaleProvider.getLabel;

class QuoteItem extends React.Component {
  constructor(props) {
    super(props);
  }
  componentDidMount() {
    let dom = ReactDOM.findDOMNode(this);
    imgZoom(dom, ".wea-cl-content");
  }
  componentDidUpdate(prevProps, prevState) {
    let dom = ReactDOM.findDOMNode(this);
    imgZoom(dom, ".wea-cl-content");
  }
  setPanelHidden = () => {
    const { clearReplyInfo, valueChange, WfFormCommunicationStore: {resetReplyParam} } = this.props;
    this.quotePanel.style.display = 'none';
    clearReplyInfo();
    resetReplyParam();
  }
 
  render() {
    const { discussantInfo = {}, remark, flowNum, showDate, zanCount, batchOperate, showRemark} = this.props;
    const {isSignLog, createUser, createUserName, createDate, createTime, createrDepName, logNodeName, logOperationName,createUserType} = this.props;
    const {isAnonymous, isDel, isMeCollected, isMeZaned, istop} = this.props;
    const {relatedaccList4E9 = [], relatedcusList4E9 = [], relateddocList4E9 = [], relatedprjList4E9 = [], relatedwfList4E9 = [], relatemutilprjs4E9 = []} = this.props;
    let headerProps = {diameter: 40, name: discussantInfo.lastname, src: discussantInfo.messagerurl};
  
    return (
      <div>
      <div className="wea-cowork-reply-item cowork-quote">
        <div>
          <div className="cowork-reply-content">
            <div>
              <span className="cowork-reply-user">
                {isSignLog ?  <div class="sign-reply-top"><span className='quote-span'>{getLabel(385534, '回复')}</span>
                {  createUserType == '1' && <a href={`javaScript:openhrm(${createUser});`} onClick={window.pointerXY}>{createUserName}</a>}
                {  createUserType == '2' && <a className="ml5" href={`javaScript: window.open('/spa/crm/static/index.html#/main/crm/customerView?customerId=${createUser}&_key=jfzmyh', '_blank')`} >{createUserName}</a>}
                <span className={'reply-span reply-department'}>{createrDepName}</span>
                <span className={'reply-span reply-date'}>{createDate}</span>
                <span className={'reply-span reply-time'}>{createTime}</span>
                <span className={'reply-span right-words'}>{'[' + logNodeName + '/' + logOperationName + ']'}</span></div>
                : <div><span className="quote-span">{getLabel(19422,'引用')}#{flowNum}</span>
                  {  createUserType == '1' && <a href={`javaScript:openhrm(${createUser});`} onClick={window.pointerXY}>{createUserName}</a>}
                  {  createUserType == '2' && <a className="ml5" href={`javaScript: window.open('/spa/crm/static/index.html#/main/crm/customerView?customerId=${createUser}&_key=jfzmyh', '_blank')`} >{createUserName}</a>}
                <span className="reply-time">{showDate}</span></div>
                }
              </span>
            </div>
            <div className="cowork-reply-remark">
              <div
                className="wea-cl-content"
                dangerouslySetInnerHTML={{__html: `<div class="wea-ckeditor-content">${showRemark}</div>`}}
              /> 
            </div>
            <div className="workflow-resource-list">
              {createReplyBottomAtt(getLabel(857, '相关文档')+':',relateddocList4E9, ()=>{}, "doc")}
              {createReplyBottomAtt(getLabel(1044, '相关流程') + ':',relatedwfList4E9, ()=>{}, "wf")}
              {createReplyBottomAtt(getLabel(783, '相关客户') + ':',relatedcusList4E9, ()=>{}, "crm")}
              {createReplyBottomAtt(getLabel(782, '相关项目') + ':',relatemutilprjs4E9, ()=>{}, "project")}
              {createReplyBottomAtt(getLabel(33414, '相关任务')+':',relatedprjList4E9, ()=>{}, "task")}
              {createReplyBottomAtt(getLabel(33414, '相关附件')+':',relatedaccList4E9, ()=>{}, "acc")}
              {/* <ul className="cowork-content-public cowork-content-accessory">
                {contentInfo.relatedaccList4E9.map(createAttachLi)}
              </ul> */}
            </div>
          </div>
        </div>
      </div>
    </div> 
    );
  }
}

export default QuoteItem;